var historyPic = {
		init : function(){
			$('#queryCar').select2();
			this.charts();
			this.pic();
		},
		
		charts : function(){
			var option = {
					color: ['#3398DB'],
				    tooltip : {
				        trigger: 'axis',
				        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
				            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
				        }
				    },
				    grid: {
				        left: '3%',
				        right: '4%',
				        bottom: '3%',
				        containLabel: true
				    },
				    xAxis : [
				        {
				            type : 'category',
				            nameRotate : 135,
				            data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
				            axisTick: {
				                alignWithLabel: true
				            }
				        }
				    ],
				    yAxis : [
				        {
				            type : 'value'
				        }
				    ],
				    series : [
				        {
				            name:'直接访问',
				            type:'bar',
				            barWidth: '60%',
				            data:[10, 52, 200, 334, 390, 330, 220]
				        }
				    ]
			};
			var myChart = echarts.init(document.getElementById('myCharts'));
	        myChart.setOption(option);
		},
		
		
		/**
		 * 图片切换
		 */
		pic : function(){
			var arr = [0];
			var index = 0;
			var length = $('#myCarousel').find('.largeImg').length;
			//$('#myCarousel').rebox({ selector: '.imgA' });
			$('#myCarousel').on('slide.bs.carousel', function (event) {
				var $hoder = $('#myCarousel').find('.item'),
		          $items = $(event.relatedTarget);
	        	//getIndex就是轮播到当前位置的索引
	        	var getIndex= $hoder.index($items);
	        	if(arr.indexOf(getIndex) == -1){
	        		arr.push(getIndex);
	        		//加载图片
	        	}
			});
			
			global.map();
			
			$('#myCarousel').on('click','.imgA',function(e){
				e.preventDefault();
				var src= $(this).attr('href');
				index = $(this).parent().index();
				$('#largeImgage').attr('src',src);
				$('.largeImgPop,#mask').show();
			});
			
			$('.largeImgPop').find('.close').click(function(){
				$('.largeImgPop,#mask').hide();
				$('#largeImgage').attr('src','');
			});
			
			
			$('.largeImgPop').find('.prev').click(function(){
				if(index == 0){
					index = length -1;
				}else{
					index--;
				}
				var src = $('#myCarousel').find('.imgA').eq(index).attr('href');
				$('#largeImgage').attr('src',src);
			});
			
			$('.largeImgPop').find('.next').click(function(){
				if(index == length-1){
					index = 0;
				}else{
					index++;
				}
				var src = $('#myCarousel').find('.imgA').eq(index).attr('href');
				$('#largeImgage').attr('src',src);
			});
			
		}
};

historyPic.init();